/**
 * fulihui.com Inc.
 * Copyright (c) 2015-2016 All Rights Reserved.
 */
package com.fulihui.integral.core.strategy.business;

import com.fulihui.integral.core.common.constants.RuleKeys;
import com.fulihui.integral.core.common.entity.RuleData;
import com.fulihui.integral.core.dal.mapper.ISAccountDetailMapper;
import com.fulihui.integral.core.strategy.BaseStrategy;
import com.fulihui.integral.core.strategy.StrategyParam;
import com.fulihui.integral.core.strategy.StrategyResult;
import org.near.toolkit.common.StringUtil;

import javax.annotation.Resource;

/**
 * @author zhangyingjie
 * @version $Id: v 0.1 2017年05月17日 14:14 zhangyingjie Exp $
 */
public abstract class IntegralAbstractStrategy implements BaseStrategy {
    @Resource
    ISAccountDetailMapper iSAccountDetailMapper;

    /**
     * 简单获取 积分
     *
     * @param param
     * @return
     */
    @Override
    public StrategyResult calculate(StrategyParam param) {
        RuleData ruleData = param.getRule().get(RuleKeys.FEEDBACK);
        StrategyResult result = new StrategyResult();
        if (ruleData != null) {
            Long amount = Long.valueOf(StringUtil.isBlank(ruleData.getValue()) ? "0" : ruleData.getValue());
            result.setAmount(amount);
        }
        return result;
    }
}
